package org.o14x.alpha.ui.views.foldertree;

import java.io.File;

import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.eclipse.jface.viewers.Viewer;
import org.eclipse.jface.viewers.ViewerFilter;

/**
 * Filter for the folder tree.
 * 
 * @author Olivier DANGREAUX
 */
public class FolderTreeFilter extends ViewerFilter {
	/**
	 * log.
	 */
	private Log log = LogFactory.getLog(FolderTreeFilter.class);

	@Override
	public boolean select(Viewer viewer, Object parentElement, Object element) {
		boolean select = false;
		File file = (File) element;
		String filePath = file.getPath();
		select = file.isDirectory();

		log.debug("select -> " + filePath + " : " + select);

		return select;
	}

}
